package com.mode.proxy;

public class ProxyWorker2 implements JavaApply {
    private Worker1 worker1;

    public ProxyWorker2(Worker1 worker1) {
        this.worker1 = worker1;
    }

    @Override
    public void work() {
        System.out.println("工人2在代理");
        if (worker1 == null) {
            worker1 = new Worker1();
        }
        worker1.work();
    }

}
